<template>
  <div class="topicdetail">
    <div class="main">
      <div class="detail-content" v-html="detailInfo.content"></div>
      <div class="list-title">专题推荐</div>
      <div class="list">
        <router-link
          tag="div"
          v-for="item in recommendList"
          :key="item.id"
          class="item"
          replace
          :to="`/topic/topicdetail?id=${item.id}`"
        >
          <img :src="item.scene_pic_url" alt="" />
          <p>{{ item.title }}</p>
        </router-link>
      </div>
    </div>
  </div>
</template>
<script>
import { detailaction } from "@/api/topic/index";
export default {
  data() {
    return {
      detailInfo: {}, // 详情信息
      recommendList: [], // 推荐专题
      id: "",
    };
  },
  methods: {
    // 获取专题详情
    async getDetail() {
      const { data, recommendList } = await detailaction({
        id: this.id,
      });
      this.detailInfo = data;
      this.recommendList = recommendList;
    },
  },
  created() {
    this.id = this.$route.query.id;
    this.getDetail();
  },
};
</script>
<style lang="scss" scoped>
@import "./index.scss";
</style>
